1.add report
2.add dataset
3.edit param be mulit
Query type : Text
Query :
select * from
(
select '1' as ID
union select '2'
union select '3'
union select '4'
union select '5'
) a
where ID in (@pal)
檢查1.Parameters 會出現@pal
檢查2.DataSet出現欄位
#編輯@pal
Data type : Allow multiple values
JOIN(Parameters!pal.Value,",")
顯示 : ●金 或○金
=IIF
(
JOIN(Parameters!pal.Value,",").Contains("1,2,3,4,5")=true
,"○"
,IIF
(
JOIN(Parameters!pal.Value,",").Contains("1")=true
,"●","○"
)
) & "金"
顯示 : ●ALL 或○ALL
=IIF
(
JOIN(Parameters!pal.Value,",").Contains("1,2,3,4,5")=true
,"●"
,"○"
) & "ALL"
在SQL SERVER add proc : sp_xxx @pal
create proc sp_xxx @pal varchar(max)
as
create table #tmp
(
ID varchar(8)
)
insert into #tmp select 1
insert into #tmp select 2
insert into #tmp select 3
select * from #tmp where @pal like '%'+ID+'%' --這裡要注意,要寫成這樣.
Query type : SP *這裡要選SP
Query : sp_xxx
ref
https://dotblogs.com.tw/terrychuang/2011/06/14/28315
https://www.sqlshack.com/using-multi-value-parameters-in-ssrs/